package timing.ukulele.third.service.msg;

import com.alibaba.fastjson2.JSON;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import timing.ukulele.third.mapper.msg.MessageRecordMapper;
import timing.ukulele.third.msgChannel.model.SendTaskInfo;
import timing.ukulele.third.persistent.msg.MessageRecord;
import timing.ukulele.third.service.common.BaseOperatorService;

/**
 * @Description 消息发送记录
 * @Author zh
 * @Date 2025-10-13 16:38
 */
@Service
public class MessageRecordService extends BaseOperatorService<MessageRecordMapper, MessageRecord> {

    public void  saveMessageRecord(SendTaskInfo sendTaskInfo) {
        MessageRecord messageRecord = new MessageRecord();
        BeanUtils.copyProperties(sendTaskInfo, messageRecord);
        messageRecord.setVariables(JSON.toJSONString(sendTaskInfo.getVariables()));
        messageRecord.setExtra(JSON.toJSONString(sendTaskInfo.getExtra()));
        this.save(messageRecord);
    }

}
